home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / utility / utilcli / rep.lha / rep.gc < prev    next >
Text File  |  1996-12-01  |  3KB  |  136 lines

  1. G4C   - Rep.gc - Gui4Cli GUI for the Rep replace command.
  2.  
  3.  
  4. ; This is a GUI script for the "Replace" command.
  5. ; It needs an other program I've written, called Gui4Cli (V2.1+)
  6. ; This program is a GUI runner and is available on Aminet under 
  7. ; Dev/Gui/Gui4Cli.lha - and it's *very* good :)
  8.  
  9. ; With this GUI the replace command becomes very usefull
  10. ; having the ability to easily change the same string in multiple
  11. ; files, with extreme ease..
  12.  
  13. ; You run it by clicking on it's icon, or typing from the CLI
  14. ; > run c:Gui rep.gc
  15.  
  16.  
  17. ; ----------------- The window
  18.  
  19. WinBig -1 -1 400 150 'Replace - SYS:'
  20. WinType 11110001  ; it's resizable & font sensitive with all gadgets
  21.  
  22. ; ----------------- General events
  23.  
  24. xOnLoad
  25. setvar rp_from ""
  26. setvar rp_to ""
  27. setvar rp_todir ""
  28. guiopen rep.gc
  29. RUN 'resident c:Rep pure add'
  30.  
  31. xOnClose
  32. delvar rp_#?
  33. guiquit rep.gc
  34. run 'resident Rep remove'
  35.  
  36. ; ---------------- The directory listview for choosing files to convert
  37.  
  38. xListview   0 0 200 150 "" rp_file SYS: 10 DIR
  39. GadID 1
  40. lvdirhook 1
  41. GadFont topaz.font 8 000    ; change the font if you like..
  42.  
  43. xlvdirhook 1
  44. setvar rp_curdir $$LV_DIR
  45. setwintitle rep.gc '$rp_curdir                              '
  46.  
  47. ; ---------------- move about buttons for the dir listview
  48.  
  49. xButton  210 5 30 15 P
  50. lvdir rep.gc 1 parent
  51.  
  52. xButton  240 5 30 15 D
  53. lvdir rep.gc 1 disks
  54.  
  55. xButton  270 5 30 15 A
  56. lvdir rep.gc 1 all
  57.  
  58. xButton  300 5 30 15 N
  59. lvdir rep.gc 1 none
  60.  
  61. ; ---------------- text-in gadgets for entering..
  62.  
  63. xTextIn   210 35 180 16 From: rp_from "" 100        ; string to Rep
  64. GadTitle ABOVE
  65.  
  66. xTextIn   210 65 180 16 To: rp_to "" 100        ; Rep with this
  67. GadTitle ABOVE
  68.  
  69. ; --- Dir to save file in. If this is the same dir as the file being
  70. ; --- converted, then the file will be overwriten.
  71.  
  72. xTextIn   210 95 180 16 "Save dir:" rp_todir "" 100
  73. GadTitle ABOVE
  74.  
  75.  
  76. ; ---- a text display, telling you what's going on.
  77.  
  78. TEXT 210 115 180 14 Waiting.. 100 BOX
  79. gadid 2
  80.  
  81. ; ----------------- Start converting..
  82.  
  83. xButton 210 130 90 14 Start
  84. lvmulti rep.gc 1 first
  85. if $rp_file = ""
  86.    stop
  87. endif
  88. if $rp_from = ""
  89.    ezreq 'No "From" defined!' OK ""
  90.    stop
  91. endif
  92. if $rp_to = ""
  93.    ezreq 'No "To" defined!' OK ""
  94.    stop
  95. endif
  96. setvar rp_flag 0
  97. setvar rp_destfile ""
  98. if $rp_todir > " "
  99.    extract rp_file FILE rp_fname
  100.    setvar  rp_dest $rp_todir
  101.    joinfile $rp_dest $rp_fname rp_destfile
  102. endif
  103. update rep.gc 2 '$rp_file'
  104. launch 5 'Rep $rp_file $rp_from $rp_to $rp_destfile'
  105.  
  106. ; Use of the launch command will allow the other GUIs running on
  107. ; this instance of Gui4Cli to go about their business normally
  108.  
  109. xOnReturn 5
  110. update rep.gc 2 'OK - $rp_file'
  111. lvmulti rep.gc 1 OFF
  112. if $rp_flag != 0
  113.    stop
  114. endif
  115. lvmulti rep.gc 1 next
  116. if $rp_file = ""
  117.    lvdir rep.gc 1 refresh
  118.    stop
  119. endif
  120. if $rp_todir > " "
  121.    extract rp_file FILE rp_fname
  122.    setvar  rp_dest $rp_todir
  123.    joinfile $rp_dest $rp_fname rp_destfile
  124. endif
  125. update rep.gc 2 '$rp_file'
  126. launch 5 'Rep $rp_file $rp_from $rp_to $rp_destfile'
  127.  
  128.  
  129. ; --------------- Cancel the rest of the files chosen.
  130.  
  131.  
  132. xButton 300 130 90 14 Stop
  133. setvar rp_flag 1
  134.  
  135.  
  136.